package com.acwing.partition15;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/2/11 18:05
 */
public class AC1471牛奶工厂 {

    private static final int N = 110;
    private static boolean[][] graph = new boolean[N][N];

    private static int n = 0;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        n = Integer.parseInt(reader.readLine());
        for (int i = 0; i < n - 1; i++) {
            String[] ss = reader.readLine().split(" ");
            int a = Integer.parseInt(ss[0]), b = Integer.parseInt(ss[1]);
            //反向建图
            graph[b][a] = true;
        }
        //传递闭包
        for (int k = 1; k <= n; k++) {
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= n; j++) {
                    graph[i][j] |= graph[i][k] && graph[k][j];
                }
            }
        }
        //枚举一下最小的答案
        int ans = -1;
        for (int i = 1; i <= n; i++) {
            boolean flag = true;
            for (int j = 1; j <= n; j++) {
                if (i == j) continue;
                if (!graph[i][j]) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                ans = i;
                break;
            }
        }
        writer.write(ans + "\n");
        writer.flush();
    }
}
